package file;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class WordGame {

	public void SearchFile(String fileName) throws Exception{
		String text=null;
		String comWord=null;
		String put=null;
		
		File dir = new File(fileName);
		String wordFile[] = dir.list();	

			for(int i=0; i<wordFile.length;i++){
				if(wordFile.length != 0){
					comWord=wordFile[i];					//	
				}else{
					System.out.print("파일이 없습니다.");				
				}
			}
		////////////////////////////	
			FileInputStream inFile = new FileInputStream("t.txt"); //comWord  파일(input에 넣어둔 text파일 은 읽어오는데 경로가 오류있어 직접넣어줌 
			BufferedReader bf = new BufferedReader(new InputStreamReader(inFile));
			
			InputStreamReader userText= new InputStreamReader(System.in);
			BufferedReader uf = new BufferedReader(userText);		
			put=uf.readLine();
			
			while((text=bf.readLine())!=null){
				
				System.out.println("나:"+put+ "\n 문서:" +text);
			}			
		}		

	
	public static void main(String[] args) throws Exception {
		WordGame aa = new WordGame();
		aa.SearchFile("input");
	}

}
